home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*----------------------------------------------------------------------------
- *
- * file : init.c
- *
- * Author : Yusuf Attarwala
- * Date : Sep 93
- *
- *---------------------------------------------------------------------------*/
-
- #include "globals_vol.h"
-
- initFog()
- {
- fog = 0;
- fogMode = FG_VTX_EXP;
- fogDensity = 0.001;
- fogRGB[_R] = 0.01;
- fogRGB[_G] = 0.01;
- fogRGB[_B] = 0.01;
- startFog = near;
- endFog = far;
- }
-
- defFog()
- {
- startFog = far;
- endFog = near;
-
- switch(fogMode) {
- case FG_VTX_EXP :
- case FG_PIX_EXP :
- case FG_VTX_EXP2 :
- case FG_PIX_EXP2 :
- fogParams[0] = fogDensity;
- fogParams[1] = fogRGB[_R];
- fogParams[2] = fogRGB[_G];
- fogParams[3] = fogRGB[_B];
- break;
- case FG_VTX_LIN :
- case FG_PIX_LIN :
- fogParams[0] = startFog;
- fogParams[1] = endFog;
- fogParams[2] = fogRGB[_R];
- fogParams[3] = fogRGB[_G];
- fogParams[4] = fogRGB[_B];
- break;
- }
- fogvertex(fogMode,fogParams);
- }
-
-
- void
- initClipplanes()
- {
- register int i,j;
-
- displayClipPlanes = 0; /* display planes by default */
- doClipping = 0;
- activeClipPlane = 0;
- for (i=0;i<MAXCLIP;i++) {
- clip[i].onOff = 0;
- for (j=0;j<4;j++) {
- clip[i].coeff[j] = 0.0;
- }
- clip[i].onOff = 0;
- for (j=0;j<3;j++) {
- clip[i].xyz[j] = 0.0;
- }
- }
-
- /* initialize these planes to be parallel to model axes */
-
- clip[0].coeff[0] = 1.0;
- clip[1].coeff[0] = -1.0;
-
- /* for oblique
- clip[0].coeff[0] = clip[0].coeff[1] =0.707;
- clip[1].coeff[0] = clip[1].coeff[1] =-0.707;
- */
-
- clip[2].coeff[1] = 1.0;
- clip[3].coeff[1] = -1.0;
- clip[4].coeff[2] = 1.0;
- clip[5].coeff[2] = -1.0;
- }
-
- void
- initGlobals()
- {
- int i,j;
- extern unsigned long packc();
-
- refresh = 0;
- screenAxes = 1;
- trackBall = 0;
- drawMode = WIREFRAME; /* or start as WIREFRAME */
- drawMode = TEXTURED; /* or start as WIREFRAME */
- drawAxis = 0;
- doLighting = 0;
- degenMode = 0;
- doubleBuffer = 1;
- dontBlend = 0;
- lightWeight = 0;
- lightWeightCount = 1;
- moveSlice = 0;
- lockAView = 0;
- obliquePlane = 0;
-
- cpackAlpha = 0xff;
- cpackRed = 0xff;
- cpackGreen = 0xff;
- cpackBlue = 0xff;
- cpackValue = packc(cpackAlpha,cpackBlue,cpackGreen,cpackRed);
-
- copy_matrix(identity,mmat);
- copy_matrix(identity,vmat);
- copy_matrix(mmat,reset_mmat);
- copy_matrix(vmat,reset_vmat);
-
- initClipplanes();
- initFog();
- }
-
- void
- obliquePlaneToggle()
- {
- int i,j;
- obliquePlane = !obliquePlane;
- if (obliquePlane) {
- clip[0].coeff[0] = clip[0].coeff[1] =0.707;
- clip[1].coeff[0] = clip[1].coeff[1] =-0.707;
-
- clip[2].coeff[1] = clip[2].coeff[2] =0.707;
- clip[3].coeff[1] = clip[3].coeff[2] =-0.707;
-
- clip[4].coeff[2] = clip[4].coeff[0] =0.707;
- clip[5].coeff[2] = clip[5].coeff[0] =-0.707;
- }
- else {
- for (i=0;i<MAXCLIP;i++) {
- for (j=0;j<4;j++) {
- clip[i].coeff[j] = 0.0;
- }
- }
- clip[0].coeff[0] = 1.0;
- clip[1].coeff[0] = -1.0;
-
- clip[2].coeff[1] = 1.0;
- clip[3].coeff[1] = -1.0;
-
- clip[4].coeff[2] = 1.0;
- clip[5].coeff[2] = -1.0;
- }
- }
-